Package gwtappcontainer.server.apis.admin

Source Code of gwtappcontainer.server.apis.admin.UserEntity

package gwtappcontainer.server.apis.admin;


import gwtappcontainer.shared.apis.admin.RoleProp;
import gwtappcontainer.shared.apis.admin.UserProp;

import java.util.ArrayList;
import java.util.List;

import com.googlecode.objectify.Ref;
import com.googlecode.objectify.annotation.Cache;
import com.googlecode.objectify.annotation.Entity;
import com.googlecode.objectify.annotation.Id;
import com.googlecode.objectify.annotation.Index;
import com.googlecode.objectify.annotation.Load;

@Entity @Cache
public class UserEntity {
  @Id Long id;
  @Index String email;
 
  @Load List<Ref<RoleEntity>> roles;

  public UserProp toProp() {
    UserProp prop = new UserProp();
   
    prop.id = id;
    prop.email = email;
   
    prop.roles = new ArrayList<RoleProp>();   
   
    if (null != roles) {
      for (Ref<RoleEntity> entity : roles) {
        prop.roles.add(entity.get().toProp());
      }
    }
       
    return prop;
  }
}
TOP

Related Classes of gwtappcontainer.server.apis.admin.UserEntity

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.